home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / macgambit-20-compiler-src-p1 / Runtime (.c & .h) / os_mac_eEdit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-26  |  6.2 KB  |  213 lines  |  [TEXT/KAHL]

  1. /* eEdit.h     */
  2. /* 14Apr92  e  */
  3. /* 28Sep92  e  added print stuff */
  4.  
  5. #if (THINK_C < 5)
  6. #include <MacTypes.h>
  7. #include <MemoryMgr.h>
  8. #include <QuickDraw.h>
  9. #include <FontMgr.h>
  10. #include <ControlMgr.h>
  11. #include <WindowMgr.h>
  12. #include <EventMgr.h>
  13. #include <DeskMgr.h>
  14. #include <TextEdit.h>
  15. #include <ToolboxUtil.h>
  16. #include <SysErr.h>
  17. #include <PrintMgr.h>
  18. #include <PrintTraps.h>
  19. #else
  20. #include <Types.h>
  21. #include <THINK.h>
  22. #include <Memory.h>
  23. #include <Quickdraw.h>
  24. #include <Fonts.h>
  25. #include <Controls.h>
  26. #include <Windows.h>
  27. #include <Events.h>
  28. #include <Scrap.h>
  29. #include <TextEdit.h>
  30. #include <ToolUtils.h>
  31. #include <Errors.h>
  32. #include <Printing.h>
  33. #include <Menus.h>
  34. #endif
  35.  
  36. #define CONTEXT_LINES         3            /* lines to show around caret for eTeShowCaret() */
  37.  
  38. #define    PAGE_DELAY            1
  39.  
  40. #define MIN_RUNS            (10)        /* # runs to extend the run starts block */
  41. #define MIN_LINES            (100)        /* # lines to extend the line starts block */
  42. /* 28May92  e  was:
  43. #define MAX_SCROLL_CHARS    (1024)        /* max # of chars to scroll horizontally */
  44.  
  45. /*
  46.  * ASCII character definitions
  47.  */
  48. #define ENTER            0x03            /* keypad ENTER */
  49. #define DELETE            0x08            /* delete/backspace key */
  50. #define TAB                0x09            /* normal TAB    - stored in text */
  51. #define RETURN            0x0D            /* normal RETURN - stored in text */
  52. #define SPACE            0x20
  53.  
  54. /*
  55.  * ARROW key definitions - uses ASCII codes, not keycodes.
  56.  */
  57. #define LEFT_ARROW        0x1C
  58. #define RIGHT_ARROW        0x1D
  59. #define UP_ARROW        0x1E
  60. #define DOWN_ARROW        0x1F
  61.  
  62. /*
  63.  * KEYCODE definitions for function keys on extended keyboard
  64.  */
  65. #define KeyF1            0x7A
  66. #define KeyF2            0x78
  67. #define KeyF3            0x63
  68. #define KeyF4            0x76
  69. #define KeyF5            0x60
  70. #define KeyF6            0x61
  71. #define KeyF7            0x62
  72. #define KeyF8            0x64
  73. #define KeyF9            0x65
  74. #define KeyF10            0x6D
  75. #define KeyF11            0x67
  76. #define KeyF12            0x6F
  77. #define KeyF13            0x69
  78. #define KeyF14            0x6B
  79. #define KeyF15            0x71
  80.  
  81. #define KeyHelp            0x72
  82. #define KeyHome            0x73
  83. #define KeyPageUp        0x74
  84. #define KeyDel            0x75
  85. #define KeyEnd            0x77
  86. #define KeyPageDown        0x79
  87.  
  88. /*  8Jul92  e   for: curStyle  */
  89. #define NOSTYLE (-1)
  90.  
  91. typedef long LineRec;
  92.  
  93. typedef long RunRec;
  94.  
  95. struct ChPos {
  96.     short v;
  97.     short h;
  98. };
  99. typedef struct ChPos ChPos;
  100.  
  101. typedef struct eRec
  102. {    Rect         viewRect;
  103.     Rect         caretRect;
  104.     ChPos         bounds;
  105.     ChPos         position;
  106.     ChPos         caretChPos;
  107.     ChPos         selStart;
  108.     ChPos         selEnd;
  109.     ChPos         writeChPos;        /* chpos for writer (vs. human editor) 8Jul92  e  */
  110.     Boolean     selActive;
  111.     Boolean     caretState;
  112.     Boolean     active;
  113.     Boolean     dirty;
  114.     short         leftMargin;
  115.     short         topMargin;
  116.     short         hContext;        /* #chars/#lines visible around caret in eTeShowCaret() */
  117.     short         vContext;
  118.     short         hOverlap;        /* #chars/#lines visible between one page scroll & the next */
  119.     short         vOverlap;
  120.     short         hStep;            /* #chars/#lines to step for scroll arrow */
  121.     short         vStep;
  122.     short         wrap;            /*              5Jul92  for line wrap, max chars/line */
  123.     short        tabStops;        /*              8Jul92  measured in spaces */
  124.     short        autoInd;        /*                25Jan93  auto indent flag   */
  125.     short        spare;
  126.     short        hSpan;            /* computed */
  127.     short        vSpan;
  128.     short         hScale;            /* computed - pixels per scroll unit */
  129.     short         vScale;
  130.     long         hOrigin;        /* computed */
  131.     long         vOrigin;
  132.     short         width;            /* computed */
  133.     short         height;
  134.     short         caretHeight;    /* computed */
  135.     short         fontAscent;
  136.     short         tabWidth;        /* computed     8Jul92  renamed */
  137.     short         spaceWidth;
  138.     short         maxRight;        /* computed */
  139.     short         qRuns;
  140.     short         linesAllocated;    /* computed */
  141.     short         runsAllocated;
  142.     short         curStyle;        /* computed     8Jul92  to speed up drawing */
  143.     short        fustStyle;
  144.     TextStyle    style[2];        /* use eTeSetStyles() */
  145.     ProcPtr     eTeWordBreak;    /* use eTeWordBreak() */
  146.     WindowPtr     macPort;        /* use eTeNew() */
  147.     ControlHandle hSBar;        /* use eTeNew() */
  148.     ControlHandle vSBar;        /* use eTeNew() */
  149.     Handle         hText;            /* use eTeNew() or eTeSetTextHandle() */
  150.     LineRec     **hLines;        /* computed */
  151.     long         **hRuns;        /* computed */
  152.     THPrint        hPrint;            /* Handle to print record for file       28Sep92  e  */
  153. } eRec, **eTeHandle;
  154.  
  155. OSErr    eTePrint( eRec **hE, Boolean jobDlg, Boolean firstJob, Str255 flnm);    /*   28Sep92  e  */
  156.  
  157. ChPos     eTeOffsetToChPos( eRec **hE, register long anOffset );
  158. long     eTeChPosToOffset( eRec **hE, ChPos aPos );
  159. long     eTeTextLength( eRec **hE );
  160.  
  161. void     eTeGetRun( eRec **hE, long *sta, long *end );
  162.  
  163. void     eTeScroll( eRec **hE, short hDelta, short vDelta, Boolean redraw );
  164. void     eTeScrollTo( eRec **hE, ChPos aPosition, Boolean redraw );
  165. void     eTeShowCaret( eRec **hE );
  166.  
  167. void     eTeSetWrap( eRec **hE, short wrap );
  168. void     eTeSetTabStop( eRec **hE, short aTabStop );
  169. void     eTeSetWordBreak( eRec **hE, ProcPtr aFunc );
  170.  
  171. void     eTePutScrap();                                  /*  13Aug92  e  */
  172. void     eTeGetScrap();                                  /*  13Aug92  e  */
  173. void    eTeUndo( eRec **hE );                           /*  13Aug92  e  */
  174. void    eTeEditMenuUpdate( eRec **hE, MenuHandle hM );    /*  13Aug92  e  */
  175.  
  176. void     eTeIdle( eRec **hE );
  177. void     eTeActivate( eRec **hE );
  178. void     eTeDeactivate( eRec **hE );
  179. void     eTeDraw( eRec **hE, Rect *area );
  180. void     eTeUpdate( eRec **hE );
  181. void     eTeClick( eRec **hE, Point hitPt, short modifierKeys, long when );
  182. void     eTeCut( eRec **hE );
  183. void     eTeCopy( eRec **hE );
  184. void     eTeDelete( eRec **hE );
  185. void     eTeKillTo( eRec **hE, ChPos chPos );  /* 12Jul92  e */
  186. void     eTePaste( eRec **hE, short style );
  187. void     eTeInsert( eRec **hE, Ptr textPtr, long numChars, short style );
  188. void     eTeWrite(  eRec **hE, Ptr textPtr, long numChars, short style );      /*  9Jul92  e */
  189. void     eTeTranspose( eRec **hE, long beg, long midl, long midr, long end ); /* 22Jul92  e */
  190. void     eTeKey( eRec **hE, char theChar, Byte keyCode, short modifiers, short style );
  191. void     eTeSetSelect( eRec **hE, long aStart, long anEnd );
  192.  
  193. short     eTeSetTextPtr( eRec** hE, Ptr pT, long numChars );
  194. short     eTeSetTextHandle( eRec** hE, Handle hT );
  195. short     eTeSetTextHandleDetabify( eRec **hE, Handle hT, short tabstops );
  196.  
  197. void     eTeNewView( eRec **hE, Rect *view );
  198. void     eTeSetStyles( eRec **hE, TextStyle *ts0, TextStyle *ts1 );
  199.  
  200. void     eTeInit( void );
  201. eRec  **eTeNew( WindowPtr macPort, Rect viewRect, short tabStops, short wrap,
  202.                  short autoInd, ControlHandle aHSizing, ControlHandle aVSizing );
  203. void     eTeDispose( eRec **hE );
  204.  
  205. extern EventRecord        gLastMouseUp;
  206. extern EventRecord        gLastMouseDown;
  207. extern long                gMaxSleep;
  208.  
  209. long balance_fwd( eRec **hE, int bal );
  210. long balance_bwd( eRec **hE, int bal, int prefix );
  211.  
  212. /* end of eEdit.h */
  213.